package com.woniu.micropropertyserver.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.microcommonsserver.entity.PassCarCheckEntity;
import com.woniu.micropropertyserver.bean.DeployParkCCheck;
import com.woniu.micropropertyserver.mapper.PassCarCheckMapper;
import com.woniu.micropropertyserver.service.IPassCarCheckService;
import com.woniu.micropropertyserver.util.PageRest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author ：bb
 * @date ：Created in 2021/2/2 0002
 * @description：
 * @modified By：
 * @version: $
 */
@Transactional(readOnly = true)
@Service
public class PassCarCheckServiceImpl implements IPassCarCheckService {
    @Resource
    private PassCarCheckMapper passCarCheckMapper;

    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    @Override
    public int saveInfo(DeployParkCCheck passCarCheckEntity) {
        return passCarCheckMapper.saveInfo(passCarCheckEntity);
    }

    @Override
    public PageInfo<DeployParkCCheck> findByParam(PageRest pageRest, DeployParkCCheck passCarCheckEntity) {

            return PageHelper.startPage(pageRest.getPageNum(),pageRest.getPageSize()).doSelectPageInfo(()->passCarCheckMapper.findByParam(pageRest,passCarCheckEntity));
    }

    @Override
    public DeployParkCCheck findByCarNum(String CarNum) {
        return passCarCheckMapper.findByCarNum(CarNum);
    }

    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    @Override
    public int updateInfo(DeployParkCCheck passCarCheckEntity) {
        return passCarCheckMapper.updateInfo(passCarCheckEntity);
    }

    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    @Override
    public int cancelInfo(Long id) {
        return passCarCheckMapper.cancelInfo(id);
    }
}
